package com.jack.web;

import com.jack.client.CustomerClient;
import com.jack.client.PersonClient;
import com.jack.domain.model.Customer;
import com.jack.domain.model.PersonModel;
import com.jack.domain.response.base.HttpResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by LiJiakui on 17/4/19.
 */
@Controller
public class CustomerController {
    private static Logger log = LoggerFactory.getLogger(CustomerController.class);

    @Autowired
    CustomerClient customerClient;

    @Autowired
    PersonClient personClient;

//    @Autowired
//    PersonClient personClient;
    @RequestMapping("/getCust")
    @ResponseBody
    public Customer getCust(){
        log.info("获取用户");
        return customerClient.getCustomer();
    }

    @RequestMapping("/getPerson")


    @ResponseBody
    public PersonModel getPerson(Integer id){
        return customerClient.selectById(id);
    }

    @RequestMapping("/getCustomer")
    @ResponseBody
    public HttpResponse getCustomer(String data){
        return personClient.getCustomerByUkey(data);
    }
}
